<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>登录页</title>
	<link rel="stylesheet" type="text/css" href="/login_assets/css/style.css">
</head>
<body>
	<div class="container">
		<div class="admin-top"><img src="/login_assets/img/001_03.png"><span>福祉之家后台管理系统</span></div>
		<div class="content">
            <form class="form-signin" role="form">
			<div class="texts">
			<input type="text" placeholder=" 请输入用户名" required autofocus id="inputName" name="name"/>
			<input type="password" required id="inputPasswd" name="passwd" placeholder=" 请输入密码">
		    </div>
			<div class="psd"><input type="checkbox" value="remember" name="remember"><label>记住密码</label></div>
        <div class="alert alert-warning hidden" role="alert" id="error-msg"></div>
            <button type="buttton" id="btnSubmit">登录</button>
            </form>
		</div>
	</div>
<script src="/plugins/jQuery/jquery-2.1.1.min.js"></script>
<script src="/plugins/bootstrap/js/bootstrap.min.js"></script>
<script>
    $(function(){
        $('#inputName').focus();
        $('#btnSubmit').click(function(){
            $.post('/admin_login/login',$("form.form-signin").serialize(),function(obj){
                if(obj.status == 0){
                    $('#error-msg').html(obj.msg);return;
                    $('#error-msg').removeClass('hidden');
                    if(obj.msg == '验证码错误'){
                         $('#captchaimg').attr('src', '/admin_login/captcha?t='+Math.random())
                    }
                }else{
                    location.href = '/admin_index/'; 
                }
            }); 
        });
        $('body').bind('keyup',function(event){
            if(event.keyCode == 13){
                $('#btnSubmit').click();
            }
        });
    })
</script>
</body>
</html>
